
window.onload = function (){
    initInfo();
}
function initInfo(){
    initUser();
    initChannel();
}

function initUser(){
    axios.get("/user/getLoginUser").then(resp=>{
        $("userName").innerHTML=resp.data.userName;
        $("email").innerHTML=resp.data.email;
        $("img").src=`/productImg/${resp.data.imgPath}`
    })
}

function initChannel(){
    axios.get("/channel/findAll").then(resp=>{
        console.log("============")
        var info = resp.data;
        var str = "";
        info.forEach(n =>{
            str += `<tr><td><a href="/mainPost.html?channelID=${n.id}">${n.title}</a></td><td>${n.des}</td><td>${n.sumMainPost}</td><tr>`
        });
        $("data").innerHTML = str;
    })
}
